{extend name="../../admin/view/main"}

{block name='content'}
<form action="{:sysuri()}" class="layui-card layui-form" data-auto="true" method="post">
    <div class="layui-card-body">
        <label class="layui-col-xs6">
            <span class="help-label"><b>标题</b>News Title</span>
            <input class="layui-input" name="title" placeholder="请输入标题" required value='{$vo.title|default=""}'>
        </label>

        <label class="layui-col-xs6">
            <span class="help-label"><b>关键字</b></span>
            <input class="layui-input" name="key" placeholder="请输入关键字" required value='{$vo.key|default=""}'>
        </label>

        <label class="layui-form-item relative block">
            <span class="help-label"><b>排序</b></span>
            <input class="layui-input" name="sort" placeholder="请输入排序" required value='{$vo.sort|default=""}'>
            <span class="help-block"><b>必选，</b>数字越小越在前面</span>
        </label>

        <label class="layui-col-xs6">
            <span class="help-label"><b>信息来源</b></span>
            <input class="layui-input" name="sources" placeholder="请输入信息来源" required value='{$vo.sources|default=""}'>
        </label>

        <div class="layui-form-item label-required-prev">
            <span class="help-label"><b>封面图片</b></span>
            <div class="relative block label-required-null">
                <input class="layui-input think-bg-gray" name="img" placeholder="请上传封面图片" readonly required value='{$vo.img|default=""}'>
                <a class="layui-icon layui-icon-upload input-right-icon" data-file data-field="img" data-type="gif,png,jpg,jpeg"></a>
            </div>
        </div>

        <label class="layui-col-xs6">
            <span class="help-label"><b>副标题</b></span>
            <textarea class="layui-textarea" name="subtitle" placeholder="请输入副标题">{$vo.subtitle|default=''}</textarea>
        </label>

        <div class="layui-form-item label-required-prev">
            <span class="help-label"><b>内容详情</b></span>
            <div class="relative block">
                <textarea class="layui-hide" name="content" placeholder="请输入内容详情">{$vo.content|default=''}</textarea>
            </div>
        </div>
        <br>
        <br>
        <label class="layui-col-xs12">
            <span class="help-label" style="display: none;"><input name="site_info[]" type="checkbox" value="0" class="test_realm"></span>
            <span class="help-label"><b>发布站点</b></span>
            <br>
            <br>
            {foreach ['1'=>'总网','2' => '长沙','3' => '南昌', '4' => '衡阳', '5' => '南宁', '6' => '合肥', '7' => '广州'] as $v}
            {if isset($vo.site_infos) && is_array($vo.site_infos) && in_array($v, $vo.site_infos)}
                <label class="think-radio"><input name="site_info[]" type="checkbox" value="{$v}"  lay-ignore checked title="{$v}">{$v}</label>
            {else}
                <label class="think-radio"><input name="site_info[]" type="checkbox" value="{$v}" lay-ignore title="{$v}" >{$v}</label>
            {/if}
            {/foreach}
        </label>

        <label class="layui-form-item relative block">
            <span class="help-label"><b>阅读量</b></span>
            <input class="layui-input" name="read_num" placeholder="请输入阅读量" required value='{$vo.read_num|default=""}'>
        </label>

        {notempty name='vo.id'}
        <label class="layui-form-item relative block">
            <span class="help-label"><b>真实阅读量</b></span>
            <input class="layui-input layui-disabled"  readonly="true" value='{$vo.real_read_num|default="0"}'>
        </label>
        {/notempty}

        <div class="hr-line-dashed"></div>
        {notempty name='vo.id'}<input name='id' type='hidden' value='{$vo.id}'>{/notempty}

        <div class="layui-form-item text-center">
            <button class="layui-btn" type="submit">保存数据</button>
            <button class="layui-btn layui-btn-danger" data-history-back data-confirm="确定要取消编辑吗？" type='button'>取消编辑</button>
        </div>
    </div>

</form>

<script>
    $('input[name="img"]').uploadOneImage();
    $('input[name="custom_img"]').uploadOneImage();
    require(['ckeditor'], function () {
        window.createEditor('[name=content]', {height: 350})
    });
</script>
{/block}
